﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using ScrumTable.Common;
using ScrumTable.Common.Monitoring;
using ScrumTable.Common.Security;
using ScrumTable.DL.Data.Generic.Cache;
using ScrumTable.DL.Data.Schema.ScrumTableV1;

#endregion

namespace ScrumTable.DL.Data.TFS.Bulk.Services.IterationHandling
{
    /// <summary>
    /// This class is used to create instances of iteration handling objects.
    /// </summary>
    internal static class IterationHandlingFactory
    {
        #region Declarations
        //--------------------------------------------------------------------
        // Declarations
        //--------------------------------------------------------------------

        #endregion

        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        #endregion

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        /// <summary>
        /// Creates a new iteration loader instance, which must be complaint 
        /// to the provided schema. This means that if an iteration work item
        /// name (MappedName) is provided the driver tries to retrieve the data
        /// from the iteration work items. Otherwise the data of an iteration
        /// is stored into the WSS.
        /// </summary>
        /// <param name="schema">Specifies the schema instance which is used to determine the right loader.</param>
        /// <returns>Returns the created iteration instance.</returns>
        internal static IterationLoaderBase CreateIterationLoader(IterationSchema schema)
        {
            PreCondition.AssertNotNull(schema, "schema");

            return new Tfs11IterationLoader(schema);
        }

        /// <summary>
        /// Creates a new iteration saver instance, which must be complaint 
        /// to the provided schema. This means that if an iteration work item
        /// name (MappedName) is provided the driver tries to store the data
        /// into the iteration work items. Otherwise the data of an iteration
        /// is stored into the WSS.
        /// </summary>
        /// <param name="schema">Specifies the schema instance which is used to determine the right loader.</param>
        /// <returns>Returns the created iteration instance.</returns>
        internal static IterationSaverBase CreateIterationSaver(IterationSchema schema)
        {
            PreCondition.AssertNotNull(schema, "schema");

            return new Tfs11IterationSaver(schema);
        }

        #endregion

        #region Events
        //--------------------------------------------------------------------
        // Events
        //--------------------------------------------------------------------

        #endregion
    }
}